<?php 
namespace Leads\Model\Entity;

class email
{
	protected $_id;
	protected $_emailaddress;
	protected $_isinvalid;
	protected $_optout;
	
	

	public function exchangeArray($data)
	{
		$this->id= (isset($data['id'])) ? $data['id'] : null;
		$this->_emailaddress= (isset($data['emailaddress'])) ? $data['emailaddress'] : null;
		$this->_isinvalid= (isset($data['isinvalid'])) ? $data['isinvalid'] : null;
		$this->_optout= (isset($data['optout'])) ? $data['optout'] : null;
	}
	
	public function __construct(array $options = null) {
		if (is_array($options)) {
			$this->setOptions($options);
		}
	}
	
	public function __set($name, $value) {
		$method = 'set' . $name;
		if (!method_exists($this, $method)) {
			throw new Exception('Invalid Method');
		}
		$this->$method($value);
	}
	
	public function __get($name) {
		$method = 'get' . $name;
		if (!method_exists($this, $method)) {
			throw new Exception('Invalid Method');
		}
		return $this->$method();
	}
	
	public function setOptions(array $options) {
		$methods = get_class_methods($this);
		foreach ($options as $key => $value) {
			$method = 'set' . ucfirst($key);
			if (in_array($method, $methods)) {
				$this->$method($value);
			}
		}
		return $this;
	}
	
	public function getId() {
		return $this->_id;
	}
	public function setId($id) {
		$this->_id = $id;
		return $this;
	}
	
	public function getEmailAddress() {
		return $this->_emailaddress;
	}
	public function setEmailAddress($emailaddress) {
		$this->_emailaddress = $emailaddress;
		return $this;
	}
	
	public function getIsInValid() {
		return $this->_isinvalid;
	}
	public function setIsInValid($isinvalid) {
		$this->_isinvalid = $isinvalid;
		return $this;
	}
	
	public function getOptout() {
		return $this->_optout;
	}
	public function setOptout($optout) {
		$this->_optout = $optout;
		return $this;
	}
}

?>